home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / GMS / Includes / games / games.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-09  |  13.5 KB  |  418 lines

  1. #ifndef GAMES_GMS_H
  2. #define GAMES_GMS_H TRUE
  3.  
  4. /*
  5. **   $VER: games.h V0.6B
  6. **
  7. **   General include file for programs using the Games Master System.
  8. **
  9. **   (C) Copyright 1996-1997 DreamWorld Productions.
  10. **       All Rights Reserved
  11. */
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include <exec/types.h>
  15. #endif
  16.  
  17. #ifndef UTILITY_TAGITEM_H
  18. #include <utility/tagitem.h>
  19. #endif
  20.  
  21. #ifndef GMS_SOUND_H
  22. #include <games/sound.h>
  23. #endif
  24.  
  25. #ifndef GMS_MISC_H
  26. #include <games/misc.h>
  27. #endif
  28.  
  29. #ifndef GMS_IMAGE_H
  30. #include <games/image.h>
  31. #endif
  32.  
  33. #ifndef GMS_SCREENS_H
  34. #include <games/screens.h>
  35. #endif
  36.  
  37. /***************************************************************************/
  38.  
  39. #define GMSVersion  0
  40. #define GMSRevision 6
  41.  
  42. #define TAGS       0x54414753
  43. #define LIST       0x4C495354
  44. #define OBJECTLIST 0x4F4C5354
  45. #define SKIPENTRY  0
  46. #define LISTEND    -1
  47. #define ENDLIST    -1
  48. #define TAGEND     0
  49. #define DEFAULT    0
  50.  
  51. /****************************************************************************
  52. ** These are the identification codes for the structures and their related
  53. ** tag lists.
  54. */
  55.  
  56. #define ID_BOB        0x4242
  57. #define ID_MBOB       0x4D42
  58. #define ID_GAMESCREEN 0x4753
  59. #define ID_SOUND      0x534D
  60. #define ID_PICTURE    0x5043
  61. #define ID_CARDSET    0x4352
  62. #define ID_ANIM       0x414D
  63. #define ID_MAP        0x4D50
  64. #define ID_MOVIE      0x4D56
  65. #define ID_FILE       0x464C
  66. #define ID_SPRITE     0x5350
  67. #define TG            0x5447
  68.  
  69. #define TAGS_BOB        (0x54470000|ID_BOB)
  70. #define TAGS_MBOB       (0x54470000|ID_MBOB)
  71. #define TAGS_GAMESCREEN (0x54470000|ID_GAMESCREEN)
  72. #define TAGS_SOUND      (0x54470000|ID_SOUND)
  73. #define TAGS_PICTURE    (0x54470000|ID_PICTURE)
  74. #define TAGS_CARDS      (0x54470000|ID_CARDS)
  75. #define TAGS_ANIM       (0x54470000|ID_ANIM)
  76. #define TAGS_MAP        (0x54470000|ID_MAP)
  77. #define TAGS_MOVIE      (0x54470000|ID_MOVIE)
  78. #define TAGS_SPRITE     (0x54470000|ID_SPRITE)
  79.  
  80. /****************************************************************************
  81. ** Helpful macros and structures.
  82. */
  83.  
  84. #define GetX(a) (BYTE)((a)>>8)  /* Decompress ZBXY format */
  85. #define GetY(a) (BYTE)(a)
  86.  
  87. /****************************************************************************
  88. **
  89. ** Universal errorcodes returned by certain functions.
  90. **
  91. */
  92.  
  93. #define ERR_OK           0  /* Function went OK (also NULL) */
  94. #define ERR_NOMEM        1  /* Not enough memory available */
  95. #define ERR_NOPTR        2  /* Required pointer not present */
  96. #define ERR_INUSE        3  /* Previous allocations have not been freed */
  97. #define ERR_NOVER        4  /* Structure version not supported or not found */
  98. #define ERR_FAILED       5  /* General failure */
  99. #define ERR_FILE         6  /* File error, eg file not found */
  100. #define ERR_DATA         7  /* There is an error in the given data */
  101. #define ERR_SEARCH       8  /* A search routine in this function failed */
  102. #define ERR_SCRTYPE      9  /* Screen type not recognised */
  103. #define ERR_GPI         10  /* Trouble initialising/using a GPI */
  104. #define ERR_RASTCOMMAND 11  /* Invalid raster command detected */
  105. #define ERR_RASTERLIST  12  /* Complete rasterlist failure */
  106. #define ERR_NORASTER    13  /* Expected rasterlist is missing from GS_Rasterlist */
  107. #define ERR_DISKFULL    14  /* Disk full error */
  108. #define ERR_FILEMISSING 15  /* File not found */
  109. #define ERR_WRONGVER    16  /* Wrong version or version not supported */
  110. #define ERR_MONITOR     17  /* Monitor driver not found or cannot be used */
  111. #define ERR_UNPACK      18  /* Problem with unpacking of data */
  112.  
  113. /****************************************************************************
  114. ** Memory types used by AllocMemBlock().  This is generally identical to the
  115. ** exec definitions but CHIP is renamed to VIDEO (displayable memory) and
  116. ** there is an addition of BLIT and SOUND specific memory.
  117. */
  118.  
  119. #define MEM_ANY       0
  120. #define MEM_CLEAR     0
  121. #define MEM_VIDEO     (1L<<1)
  122. #define MEM_BLIT      (1L<<2)
  123. #define MEM_SOUND     (1L<<3)
  124. #define MEM_UNTRACKED (1L<<31)
  125.  
  126. /****************************************************************************
  127. ** File Structure.
  128. */
  129.  
  130. #define FL_READ   0
  131. #define FL_WRITE  (1L<<0)
  132. #define FL_LOCK   (1L<<1)
  133. #define FL_NEW    (1L<<2)
  134. #define FL_FIND   (1L<<3)
  135. #define FL_UNPACK (1L<<4)
  136. #define FL_BUFFER (1L<<5)
  137.  
  138. #define FL_PACK   FL_UNPACK
  139. #define FL_SMART  FL_FIND|FL_UNPACK
  140.  
  141. #define FLV1 (ID_FILE<<16)|00
  142.  
  143. struct File {
  144.   ULONG ID;           /* "FILE" */
  145.   ULONG Stats;        /* Private */
  146.   APTR  Name;         /* Pointer to name of the file on disk */
  147.   ULONG BytePos;      /* Current position in file */
  148.   ULONG Size;         /* Total size of the file */
  149.   ULONG Flags;        /* File flags */
  150. };
  151.  
  152. /****************************************************************************
  153. ** Universal joystick status bits returned from Read_Joystick, Sega,
  154. ** JoyPad, etc...
  155. */
  156.  
  157. #define JT_SWITCH 0
  158. #define JT_ZBXY   1
  159. #define JT_DATA   2
  160.  
  161. #define JS_LEFT   (1L<<0)          /* X axis */
  162. #define JS_RIGHT  (1L<<1)
  163. #define JS_UP     (1L<<2)          /* Y axis */
  164. #define JS_DOWN   (1L<<3)
  165. #define JS_ZIN    (1L<<4)          /* Z axis!  Reserved for later... */
  166. #define JS_ZOUT   (1L<<5)
  167. #define JS_FIRE1  (1L<<16)         /* Fire Buttons */
  168. #define JS_FIRE2  (1L<<17)         /* For 2 button joysticks */
  169. #define JS_FIRE3  (1L<<18)         /* For 3 button joysticks */
  170. #define JS_FIRE4  (1L<<19)
  171. #define JS_FIRE5  (1L<<20)
  172. #define JS_FIRE6  (1L<<21)
  173. #define JS_FIRE7  (1L<<22)
  174. #define JS_FIRE8  (1L<<23)
  175.  
  176. #define JS_RED    (1L<<16)         /* CD32 buttons here */
  177. #define JS_BLUE   (1L<<17)
  178. #define JS_PLAY   (1L<<18)
  179. #define JS_RWD    (1L<<19)
  180. #define JS_FFW    (1L<<20)
  181. #define JS_GREEN  (1L<<21)
  182. #define JS_YELLOW (1L<<22)
  183.  
  184. #define JB_FIRE1  (1L<<16)         /* For the ZBXY style return type */
  185. #define JB_FIRE2  (1L<<17)         /*  (analog joysticks) */
  186. #define JB_FIRE3  (1L<<18)
  187.  
  188. #define MB_LMB    JB_FIRE1         /* Mouse button flags returned from */
  189. #define MB_RMB    JB_FIRE2         /*  ReadMouse(), in ZBXY format */
  190. #define MB_MMB    JB_FIRE3
  191.  
  192. /* Joyport specifications for calling ReadJoyStick/Mouse/JoyPad...() */
  193.  
  194. #define JPORT1    0*2
  195. #define JPORT2    1*2
  196. #define JPORT3    2*2
  197. #define JPORT4    3*2
  198.  
  199. struct JoyData {
  200.   WORD  XChange;
  201.   WORD  YChange;
  202.   WORD  ZChange;
  203.   UWORD Buttons;
  204. };
  205.  
  206. #define JD_FIRE1  0          ;Standard Fire Button (1) - LMB.
  207. #define JD_FIRE2  1          ;Standard Fire Button (2) - RMB.
  208. #define JD_FIRE3  2          ;Standard Fire Button (3) - MMB.
  209. #define JD_FIRE4  3
  210. #define JD_FIRE5  4
  211. #define JD_FIRE6  5
  212. #define JD_FIRE7  6
  213. #define JD_FIRE8  7
  214. #define JD_LMB    JD_FIRE1
  215. #define JD_RMB    JD_FIRE2
  216. #define JD_MMB    JD_FIRE2
  217.  
  218. /****************************************************************************
  219. ** GPI ID numbers
  220. */
  221.  
  222. #define GPI_SCREENS  0
  223. #define GPI_BLITTER  4
  224. #define GPI_SOUND    8
  225. #define GPI_NETWORK  12
  226. #define GPI_VECTORS  16
  227. #define GPI_FIREBALL 20
  228. #define GPI_MOVIE    24
  229. #define GPI_CARDS    28
  230. #define GPI_TEXT     32
  231. #define GPI_OBJECTS  36
  232. #define GPI_ANIM     40
  233.  
  234. /***************************************************************************
  235. ** Bob Structure.
  236. */
  237.  
  238. #define BBV1 ((ID_BOB<<16)|00)
  239. #define MBV1 ((ID_MBOB<<16)|00)
  240.  
  241. struct Framelist { /* Standard Framelist layout if pointing to bobs */
  242.   WORD GFX_XCoord; /* contained in a Picture structure. */
  243.   WORD GFX_YCoord;
  244.   WORD MSK_XCoord;
  245.   WORD MSK_YCoord;
  246. };
  247.  
  248. struct Directlist { /* Special Framelist layout for pointing directly */
  249.   APTR Graphic;     /* to the raw address of a bob (use DIRECT flag). */
  250.   APTR Mask;
  251. };
  252.  
  253. struct   Bob {
  254.   ULONG  VERSION;          /* Structure version */
  255.   APTR   Stats;            /* Private */
  256.   APTR   GfxData;          /* Pointer to graphics source */
  257.   APTR   MaskData;         /* Pointer to mask source */
  258.   UWORD  Frame;            /* Current frame */
  259.   APTR   Framelist;        /* Pointer to frame list */
  260.   WORD   SrcWidth;         /* Source Page Width in bytes */
  261.   UWORD  Width;            /* Width in pixels */
  262.   UWORD  ByteWidth;        /* Width in bytes */
  263.   UWORD  Height;           /* Height in pixels */
  264.   WORD   XCoord;           /* To X pixel */
  265.   WORD   YCoord;           /* To Y pixel */
  266.   UWORD  ClipLX;           /* Left X border in bytes (0/8) */
  267.   UWORD  ClipTY;           /* Top Y border (0) */
  268.   UWORD  ClipRX;           /* Right X border in bytes (320/8) */
  269.   UWORD  ClipBY;           /* Bottom Y border (256) */
  270.   UWORD  FPlane;           /* 1st Plane to blit to (planar only) */
  271.   UWORD  Planes;           /* Amount of planes */
  272.   ULONG  PlaneSize;        /* Size of source plane (planar only) */
  273.   ULONG  Attrib;           /* Attributes like CLIP and MASK */
  274.   APTR   PictureTags;      /* Pointer to picture tags */
  275. };
  276.  
  277. #define BBA_GfxData      (8|TAPTR)
  278. #define BBA_MaskData    (12|TAPTR)
  279. #define BBA_Frame       (16|TWORD)
  280. #define BBA_Framelist   (18|TAPTR)
  281. #define BBA_SrcWidth    (22|TWORD)
  282. #define BBA_Width       (24|TWORD)
  283. #define BBA_ByteWidth   (26|TWORD)
  284. #define BBA_Height      (28|TWORD)
  285. #define BBA_XCoord      (30|TWORD)
  286. #define BBA_YCoord      (32|TWORD)
  287. #define BBA_ClipLX      (34|TWORD)
  288. #define BBA_ClipTY      (36|TWORD)
  289. #define BBA_ClipRX      (38|TWORD)
  290. #define BBA_ClipBY      (40|TWORD)
  291. #define BBA_FPlane      (42|TWORD)
  292. #define BBA_Planes      (44|TWORD)
  293. #define BBA_PlaneSize   (46|TLONG)
  294. #define BBA_Attrib      (50|TLONG)
  295. #define BBA_PictureTags (54|TAPTR)
  296.  
  297. /***********************************************************************************/
  298.  
  299. struct MBob {
  300.   ULONG  VERSION;          /* Structure version */
  301.   APTR   Stats;            /* Private */
  302.   APTR   GfxData;          /* Pointer to graphics source */
  303.   APTR   MaskData;         /* Pointer to mask source */
  304.   UWORD  AmtEntries;       /* Amount of entries in the list */
  305.   APTR   Framelist;        /* Pointer to frame list */
  306.   WORD   SrcWidth;         /* Source Page Width in bytes */
  307.   UWORD  Width;            /* Width in pixels (optional) */
  308.   UWORD  ByteWidth;        /* Width in bytes */
  309.   UWORD  Height;           /* Height in pixels */
  310.   APTR   EntryList;        /* Pointer to entry list */
  311.   UWORD  ClipLX;           /* Left X border in bytes (0/8) */
  312.   UWORD  ClipTY;           /* Top Y border (0) */
  313.   UWORD  ClipRX;           /* Right X border in bytes (320/8) */
  314.   UWORD  ClipBY;           /* Bottom Y border (256) */
  315.   UWORD  FPlane;           /* 1st Plane to blit to (planar only) */
  316.   UWORD  Planes;           /* Amount of planes */
  317.   ULONG  PlaneSize;        /* Size of source plane (planar only) */
  318.   ULONG  Attrib;           /* Attributes like CLIP and MASK */
  319.   APTR   PictureTags;      /* Pointer to picture origin (optional) */
  320.   UWORD  EntrySize;        /* Entry size (sizeof(struct MBEntry)) */
  321. };
  322.  
  323. #define MBA_GfxData      (8|TAPTR)
  324. #define MBA_MaskData    (12|TAPTR)
  325. #define MBA_AmtEntries  (16|TWORD)
  326. #define MBA_Framelist   (18|TAPTR)
  327. #define MBA_SrcWidth    (22|TWORD)
  328. #define MBA_Width       (24|TWORD)
  329. #define MBA_ByteWidth   (26|TWORD)
  330. #define MBA_Height      (28|TWORD)
  331. #define MBA_EntryList   (30|TWORD)
  332. #define MBA_ClipLX      (34|TWORD)
  333. #define MBA_ClipTY      (36|TWORD)
  334. #define MBA_ClipRX      (38|TWORD)
  335. #define MBA_ClipBY      (40|TWORD)
  336. #define MBA_FPlane      (42|TWORD)
  337. #define MBA_Planes      (44|TWORD)
  338. #define MBA_PlaneSize   (46|TLONG)
  339. #define MBA_Attrib      (50|TLONG)
  340. #define MBA_PictureTags (54|TAPTR)
  341. #define MBA_EntrySize   (58|TWORD)
  342.  
  343. struct  MBEntry {        /* MBOB Entry Structure */
  344.   WORD   XCoord;
  345.   WORD   YCoord;
  346.   UWORD  Frame;
  347. };
  348.  
  349. #define MBE_SIZEOF sizeof(struct BobEntry)
  350.  
  351. /* Bob Attributes (Bob.Attrib) */
  352.  
  353. #define CLIP      0x00000001 /* Allow border clipping */
  354. #define MASK      0x00000002 /* Allow masking */
  355. #define STILL     0x00000004 /* This bob is not moving */
  356. #define CLEAR     0x00000008 /* Allow automatic clearing */
  357. #define RESTORE   0x00000010 /* Allow automatic background restore */
  358. #define DIRECT    0x00000020 /* Using direct graphics and mask pointers */
  359. #define FILLMASK  0x00000040 /* Fill any holes in the mask on generation */
  360. #define GENMASKS  0x00000082 /* Create and use masks for drawing this bob */
  361. #define CLRMASK   0x00000100 /* Use masks when clearing */
  362. #define CLRNOMASK 0x00000000 /* Do not use masks when clearing (default) */
  363.  
  364. #define GENMASK GENMASKS /* Synonym */
  365.  
  366. #define SKIPIMAGE 32000
  367.  
  368. /****************************************************************************
  369. ** Pixel list structures.
  370. */
  371.  
  372. struct PixelEntry {
  373.   WORD  XCoord;
  374.   WORD  YCoord;
  375.   LONG  Colour;
  376. };
  377.  
  378. struct PixelList {
  379.     UWORD  Entries;
  380.     UWORD  EntrySize;
  381.     struct PixelEntry *EntryList;
  382. };
  383.  
  384. #define SKIPPIXEL -32000
  385. #define PIXELLIST(a)
  386.  
  387. /****************************************************************************
  388. ** Map structure
  389. */
  390.  
  391. #define MPV1 ((ID_MAP<<16)|00)
  392.  
  393. struct Map {
  394.   ULONG  VERSION;          /* The structure version, MPV1 */
  395.   ULONG  Stats;            /* Private */
  396.   UWORD  Buffer;           /* Destination buffer */
  397.   UWORD  Number;           /* Map number to access for data */
  398.   APTR   MapList;          /* Pointer to the map datalist */
  399.   UWORD  Width;            /* Total width of map */
  400.   UWORD  Height;           /* Total height of map */
  401.   UWORD  XStart;           /* Get block data starting from X [byte] */
  402.   UWORD  YStart;           /* Get block data starting from Y */
  403.   UWORD  EntrySize;        /* Byte/Word/Long */
  404.   ULONG  EntryMask;        /* For special cases */
  405.   UWORD  TileWidth;        /* The width/8 of each tile (bytes) */
  406.   UWORD  TileHeight;       /* The height of each tile */
  407.   UWORD  Options;          /* Applicable Map options, eg LOCKED */
  408.   struct Picture *Picture; /* Points to the map's graphics picture */
  409.   char   *File;            /* Where to get the map data */
  410. };
  411.  
  412. #define LOCKED      0x0001 /* Blocks are blitted on 16 pixel boundaries  */
  413. #define ESIZE_BYTE  1      /* Entry size is in bytes */
  414. #define ESIZE_WORD  2      /* Entry size is in words */
  415. #define ESIZE_LONG  3      /* Entry size is in longs */
  416.  
  417. #endif
  418.